package com.trkj.dao.jpa;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojos.CcHospitalElectronic;

public interface CcHospitalElectronicDAO extends CrudRepository<CcHospitalElectronic, Long> {

	@Query("select c from CcHospitalElectronic c order by c.heDate desc")
	public List<CcHospitalElectronic> findByAll(Pageable pageable);
	@Query("select c from CcHospitalElectronic c where c.heSickid=?1 order by c.heDate desc")//BigDecimal heSickid heDoctorid
	public List<CcHospitalElectronic> findByheSickid(Pageable pageable,BigDecimal heSickid);
	@Query("select count(*) from CcHospitalElectronic c where c.heSickid=?1")//BigDecimal heSickid
	public long findByCount(BigDecimal heSickid);
	@Query("select c from CcHospitalElectronic c where c.heDoctorid=?1 order by c.heDate desc")//BigDecimal heSickid heDoctorid
	public List<CcHospitalElectronic> findByheDoctorid(Pageable pageable,BigDecimal heDoctorid);
	@Query("select count(*) from CcHospitalElectronic c where c.heDoctorid=?1")//BigDecimal heSickid
	public long findByheDoctoridCount(BigDecimal heDoctorid);
	@Query("select c from CcHospitalElectronic c where c.heId=?1")//BigDecimal heSickid
	public CcHospitalElectronic findByheDoctoridCount(Long heId);
	
	
	//查询未完成的处方单	
	@Query("select c from CcHospitalElectronic c where c.hospeleRemarks='未完成'")
	public List<CcHospitalElectronic> findByNoSuccess();
	
	
	
}
